# ref: helm template --release-name traefik --namespace ingress-controller --include-crds traefik/traefik
---
apiVersion: v1
kind: Namespace
metadata:
  name: ingress-controller
  labels:
    app.kubernetes.io/name: traefik
    app.kubernetes.io/instance: traefik

---
# Source: traefik/templates/rbac/serviceaccount.yaml
kind: ServiceAccount
apiVersion: v1
metadata:
  name: traefik
  namespace: ingress-controller
  labels:
    app.kubernetes.io/name: traefik
    app.kubernetes.io/instance: traefik-ingress-controller
    helm.sh/chart: traefik-20.7.0
    app.kubernetes.io/managed-by: Helm
  annotations:
---
# Source: traefik/templates/rbac/clusterrole.yaml
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: traefik-ingress-controller
  labels:
    app.kubernetes.io/name: traefik
    app.kubernetes.io/instance: traefik-ingress-controller
    helm.sh/chart: traefik-20.7.0
    app.kubernetes.io/managed-by: Helm
rules:
  - apiGroups:
      - extensions
      - networking.k8s.io
    resources:
      - ingressclasses
      - ingresses
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - ""
    resources:
      - services
      - endpoints
      - secrets
    verbs:
      - get
      - list
      - watch
  - apiGroups:
      - extensions
      - networking.k8s.io
    resources:
      - ingresses/status
    verbs:
      - update
  - apiGroups:
      - traefik.containo.us
    resources:
      - ingressroutes
      - ingressroutetcps
      - ingressrouteudps
      - middlewares
      - middlewaretcps
      - tlsoptions
      - tlsstores
      - traefikservices
      - serverstransports
    verbs:
      - get
      - list
      - watch
---
# Source: traefik/templates/rbac/clusterrolebinding.yaml
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: traefik-ingress-controller
  labels:
    app.kubernetes.io/name: traefik
    app.kubernetes.io/instance: traefik-ingress-controller
    helm.sh/chart: traefik-20.7.0
    app.kubernetes.io/managed-by: Helm
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: traefik-ingress-controller
subjects:
  - kind: ServiceAccount
    name: traefik
    namespace: ingress-controller
---
# Source: traefik/templates/deployment.yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: traefik
  namespace: ingress-controller
  labels:
    app.kubernetes.io/name: traefik
    app.kubernetes.io/instance: traefik-ingress-controller
    helm.sh/chart: traefik-20.7.0
    app.kubernetes.io/managed-by: Helm
  annotations:
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: traefik
      app.kubernetes.io/instance: traefik-ingress-controller
  template:
    metadata:
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/path: "/metrics"
        prometheus.io/port: "19100"
      labels:
        app.kubernetes.io/name: traefik
        app.kubernetes.io/instance: traefik-ingress-controller
        helm.sh/chart: traefik-20.7.0
        app.kubernetes.io/managed-by: Helm
    spec:
      serviceAccountName: traefik
      terminationGracePeriodSeconds: 60
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      nodeSelector:
        kubernetes.io/os: linux
        node-role.kubernetes.io/worker: ""
      containers:
      - image: {{ traefik_ingress_image }}
        imagePullPolicy: IfNotPresent
        name: traefik
        resources:
        readinessProbe:
          httpGet:
            path: /ping
            port: 18443
            scheme: HTTP
          failureThreshold: 1
          initialDelaySeconds: 2
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 2
        livenessProbe:
          httpGet:
            path: /ping
            port: 18443
            scheme: HTTP
          failureThreshold: 3
          initialDelaySeconds: 2
          periodSeconds: 10
          successThreshold: 1
          timeoutSeconds: 2
        lifecycle:
        ports:
        - name: "metrics"
          containerPort: 19100
          protocol: "TCP"
        - name: "traefik"
          containerPort: 18443
          protocol: "TCP"
        - name: "web"
          containerPort: 80
          protocol: "TCP"
        - name: "websecure"
          containerPort: 443
          protocol: "TCP"
        securityContext:
          capabilities:
            drop:
            - ALL
            add:
            - NET_BIND_SERVICE
          # readOnlyRootFilesystem: true
          # runAsGroup: 65532
          # runAsNonRoot: true
          # runAsUser: 65532
        volumeMounts:
          - name: data
            mountPath: /data
          - name: tmp
            mountPath: /tmp
        args:
          - "--global.checknewversion"
          - "--global.sendanonymoususage"
          - "--entrypoints.metrics.address=:19100/tcp"
          - "--entrypoints.traefik.address=:18443/tcp"
          - "--entrypoints.web.address=:80/tcp"
          - "--entrypoints.websecure.address=:443/tcp"
          - "--api.insecure=true"
          - "--api.dashboard=true"
          - "--ping=true"
          - "--metrics.prometheus=true"
          - "--metrics.prometheus.entrypoint=metrics"
          - "--providers.kubernetescrd"
          - "--providers.kubernetesingress"
          - "--entrypoints.websecure.http.tls=true"
      volumes:
        - name: data
          emptyDir: {}
        - name: tmp
          emptyDir: {}
      securityContext:
        fsGroup: 65532
---
# Source: traefik/templates/ingressclass.yaml
apiVersion: networking.k8s.io/v1
kind: IngressClass
metadata:
  annotations:
    ingressclass.kubernetes.io/is-default-class: "true"
  labels:
    app.kubernetes.io/name: traefik
    app.kubernetes.io/instance: traefik-ingress-controller
    helm.sh/chart: traefik-20.7.0
    app.kubernetes.io/managed-by: Helm
  name: traefik
spec:
  controller: traefik.io/ingress-controller
---
# Source: traefik/templates/dashboard-hook-ingressroute.yaml
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: traefik-dashboard
  namespace: ingress-controller
  annotations:
    helm.sh/hook: "post-install,post-upgrade"
    meta.helm.sh/release-name: traefik
    meta.helm.sh/release-namespace: ingress-controller
  labels:
    app.kubernetes.io/name: traefik
    app.kubernetes.io/instance: traefik-ingress-controller
    helm.sh/chart: traefik-20.7.0
    app.kubernetes.io/managed-by: Helm
spec:
  entryPoints:
  - traefik
  routes:
  - match: PathPrefix(`/dashboard`) || PathPrefix(`/api`)
    kind: Rule
    services:
    - name: api@internal
      kind: TraefikService